import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

import { Permission } from '../entities';

export class CreatePermissionDto {
  @ApiProperty({ description: '权限名称' })
  name: string;

  @ApiProperty({ description: '可操作的资源' })
  resource: string;

  @ApiProperty({ description: '资源的可操作性' })
  action: string;

  @ApiPropertyOptional({ type: () => CreatePermissionDto })
  parent?: Permission;

  @ApiPropertyOptional({ type: () => [CreatePermissionDto] })
  children?: Permission[];
}
